package com.yeyks.app.controller.base.other;


import com.yeyks.common.ajax.AjaxResponseBody;
import com.yeyks.other.service.AddressDivisionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 地址信息表 前端控制器
 *
 * @author fuchangshuai
 * @since 2019-06-06
 */
@Api(tags = "地址信息表接口", description = "地址信息表")
@RestController
@RequestMapping("/address/division")
public class AddressDivisionController {

    @Autowired
    public AddressDivisionService addressDivisionService;


    @ApiOperation("根据父类code获取子类的地址信息【不传查询所有省】")
    @PostMapping("/get")
    public AjaxResponseBody getAddressByParentCode(@RequestParam(value = "divCode", required = false) String divCode,
                                                   @RequestParam(value = "sourceType", defaultValue = "yyks")String sourceType) {
        return AjaxResponseBody.success(addressDivisionService.getAddressByParentCode(divCode, sourceType));
    }

}

